---
title: Node Types
sidebar_position: 2
---

Data on a [SharedTree](./index.mdx) is stored as a [node](./nodes.mdx) of one of the types described below.

## Leaf Nodes

A [leaf](../../api/fluid-framework/nodekind-enum.md#leaf-enummember) node represents an atomic value, while a [TreeNode](../../api/fluid-framework/treenode-class.md) represents an object or collection.
The following leaf node types are available:

-   [**boolean**](../../api/fluid-framework/schemastatics-interface.md#boolean-propertysignature): Works identically to a JavaScript boolean.
-   [**number**](../../api/fluid-framework/schemastatics-interface.md#number-propertysignature): Works identically to a JavaScript number except does not support -0, NaN or Infinity.
-   [**string**](../../api/fluid-framework/schemastatics-interface.md#string-propertysignature): Works identically to a JavaScript string except for not supporting unpaired UTF-16 surrogate pairs.
-   [**null**](../../api/fluid-framework/schemastatics-interface.md#null-propertysignature): Works identically to a JavaScript null.
-   [**FluidHandle**](../../api/fluid-framework/schemastatics-interface.md#handle-propertysignature): A handle to a Fluid DDS or Data Object in the current container. For more information about handles see [Handles](../../concepts/handles.mdx).

## TreeNodes

The following subsections describe the available [TreeNode](../../api/fluid-framework/treenode-class.md) types.

### Object Nodes

An [object node](../../api/fluid-framework/treeobjectnode-typealias.md) is a JavaScript object like TreeNode with zero or more named child [fields](../../api/fluid-framework/fieldschema-class.md) exposed as properties of the object.
The object node's fields can be node types.
A `SharedTree` can have many object nodes at various places in the tree and they do not all have to conform to the same schema.
Your schema can specify different properties for different object nodes.
The schema also specifies whether a child property is
[required](../../api/fluid-framework/schemastatics-interface.md#required-propertysignature),
[optional](../../api/fluid-framework/schemastatics-interface.md#optional-propertysignature)
or an [identifier](../../api/fluid-framework/schemafactory-class.md#identifier-property),
as well as what types of nodes are allowed in the field.
For example, a property could be either number or string.

### Map Nodes

A map node is a set of zero or more key-value pairs similar to a JavaScript Map object, but the keys can only be strings.
The schema for the `SharedTree` that your code defines will specify the possible node types that can be values of the keys.
It can specify that all node types are allowed or only a subset. There is no way to specify different subsets of node types for different keys.

The schema for a map node cannot specify particular key names, nor can it specify a maximum or minimum number of key-value pairs.

### Array Nodes

An array node is an indexed sequence of zero or more values like a JavaScript array.
In principle, values can be any of the node types, but the schema that your code defines will specify what subset of those types can be the values of any given array item.
